<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>账号注册</title>
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/own.css" />
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
		<style type="text/css">
			/*下面两项是重置muicss的输入框label和input之间的宽比率*/
			
			.mui-input-row label {
				width: 20%;
			}
			
			.mui-input-row label~input {
				width: 80%;
			}
		</style>
	</head>

	<body style="background-color: #FFFFFF;">

		<header class="mui-bar mui-bar-nav own-main-background-color">
			<button type="button" class="mui-action-back mui-btn  mui-btn-link mui-pull-left own-button">
			<!--<span class="mui-action-back mui-icon mui-icon-left-nav own-left-nav-color"></span>-->
			<span class="own-left-nav-color">返回</span>
		</button>
			<h1 class="mui-title">注册</h1>
		</header>

		<div class="mui-content" style="background-color: #FFFFFF;">
			<p class="mui-text-center" style="margin-top: 20px; font-size: 16px; color: #000;font-weight: bold;">已将短信验证码发送至手机</p>
			<p class="mui-text-center" style="margin-top: 10px; font-size: 18px; color: #04bb21;font-weight: bold;">+86&nbsp;&nbsp;<span id="tells"></span></p>
			<div class="mui-content own-content-padding" style="background-color: #FFFFFF;">
				<div class="mui-card" style="margin-top: 30px; border: solid 1px #04bb21 ;">
					<form class="mui-input-group">
						<div class="mui-input-row">
							<label><span class="mui-icon mui-icon-email"></span></label>
							<input id="vcode" class="mui-input-clear" type="text" placeholder="请输入短信验证码" />
						</div>
						<div id="code">
						</div>
					</form>
				</div>
				<div class="mui-button-row" style="margin: 10px 15px;">
					<button type="button" id="duanxin" class="mui-btn mui-btn-block own-btn-green" style="padding: 5px 0px;">下一步</button>
				</div>
			</div>

		</div>
		<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
		<script src="../js/mui.min.js" charset="UTF-8"></script>
		<script src="../js/own.js" charset="UTF-8"></script>
		<script src="../js/ajax.js" charset="UTF-8"></script>
		<script type="text/javascript" charset="UTF-8">
			mui.init({
				swipeBack: true
			});
				
			mui.plusReady(function() {
				
				document.getElementById("tells").innerHTML = plus.storage.getItem("userName");

				var	duanxin = document.getElementById("duanxin");

				duanxin.addEventListener('tap', function() {
					
					var vcode = document.getElementById("vcode").value;
					if(vcode =='') {
						mui.alert("请输入短信验证码");
						return;
					}else{
						plus.storage.setItem("code", vcode);
					}

					var data = {};
					data.account = $("#tells").text();
					data.code = vcode;

					//联网注册
					mui.ajax(url + 'rest/codeVerification', {
						data: data,
						dataType: 'json', //服务器返回json格式数据
						type: 'post', //HTTP请求类型
						timeout: 10000, //超时时间设置为10秒；

						success: function(result) {

							if(result.status != '0') {
								mui.alert(result.msg);
							} else {
								mui.openWindow({
									url: 'password.html',
									id: 'password.html'
								});

							}

						},
						error: function(xhr, type, errorThrown) {
							//异常处理；
							console.log(type);
						}
					});

				}, false);

			});

		/*	function ycode() {

				var data = {};
				data.account = $("#tells").text();
				data.code = $("#vcode").val();
				//mui.alert(data.account + ","+data.code);
				$.ajax({
					url: url + "rest/codeVerification",
					type: "POST",
					data: data,
					success: function(result) {
						result = JSON.parse(result);
						if(result.status != '0') {
							mui.alert(result.msg);
							//$("#varCodeResult").val(result.msg );
						} else {
							//$("#varCodeResult").val(result.msg );
							window.location.href = "password.html"
						}
					}
				});

			}*/
		</script>

	</body>

</html>